
package com.feituan.core.error;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@ToString
@Getter
@Setter
@EqualsAndHashCode
public class SystemCode {

    /**
     *
     */
    public static final SystemCode SYSTEM_START_EXCEPTION = new SystemCode(-1, "系统启动异常");

    /**
     * 请求成功统一返回
     * code 0
     */
    public final static SystemCode SUCCESS = new SystemCode(0, "成功");
    /**
     * 参数不正确
     * code 1
     */
    public static final SystemCode ILLEGAL_PARAM = new SystemCode(1, "参数不正确");

    /**
     * 未预期的异常！
     * code: 500
     */
    public static final SystemCode UNEXPECTED = new SystemCode(500, "未预期的异常");
    /**
     * 加解密异常110开头
     * CIPHER加解密异常 code 11001
     */
    public static final SystemCode CIPHER_ERROR = new SystemCode(11001, "加解密异常");
    /**
     * 3DES加解密异常 code 11002
     */
    public static final SystemCode CIPHER_ALGORITHM_3DES_ERROR = new SystemCode(11002, "加解密异常");
    /**
     * hash算法 异常 111开头
     * MD5hash异常 code 11101
     */
    public static final SystemCode MD5_HASH_ERROR = new SystemCode(11101, "签名异常");

    /**
     * Redis异常 112开头
     * redis连接异常 code 11201
     */
    public static final SystemCode REDIS_CONN_ERROR = new SystemCode(11201, "缓存连接异常");

    /**
     * JSON 异常 115开头
     * JSON统一异常 code 11501
     */
    public static final SystemCode JSON_EXCEPTION = new SystemCode(11501, "JSON异常");

    /**
     * Json转换异常,key is empty code 11502
     */
    public static final SystemCode JSON_EXCEPTION_KEY_IS_EMPTY = new SystemCode(11502, "Json转换异常");

    /**
     * spring.profiles.active is empty. code 11602
     */
    public static final SystemCode SPRING_CLOUD_SPRING_PROFILES_ACTIVE_EMPTY = new SystemCode(11602, "找不到激活的配置文件");

    /**
     * SystemInitialization 异常
     */
    public static final SystemCode SPRING_BOOT_INIT_EXCEPTION = new SystemCode(11603, "系统异常");

    /**
     * 锁相关异常 117开头
     */
    public static final SystemCode LOCK_EXCEPTION = new SystemCode(11701, "锁异常");

    /**
     * 网关拦截未鉴权异常
     */
    public static final SystemCode GATEWAY_UNAUTHORIZED = new SystemCode(11801, "未登录/未鉴权");

    /**
     * 非网关拦截未鉴权异常
     */
    public static final SystemCode UN_GATEWAY_UNAUTHORIZED = new SystemCode(11802, "未登录/未鉴权");


    public static final SystemCode PAY_ERROR_STATUS_NOT_CORRECT = new SystemCode(20001, "预支付失败，订单转态不对");
    public static final SystemCode PAY_PREPAY_ERROR= new SystemCode(20002, "预支付失败");

    public static final SystemCode WX_LOGIN_ERROR= new SystemCode(30001, "微信登录失败");
    public static final SystemCode WX_PAY_NOTIFY_ERROR= new SystemCode(40001, "微信通知处理失败");
    protected SystemCode(long code, String message) {
        this.code = code;
        this.message = message;
    }

    private long code;
    private String message;
}
